<?php
include('../../include/functions.inc.php');
include('../../include/inputbuilder.inc.php');
include('../../include/maintenance.inc.php');
if (isEmpty(getParam('ID'))) {
    echo 'WRONG PARAMETER';
} else {
    $maintenance = unserialize($_SESSION['mPolicy']);
    $rows = $db->query_select($maintenance->table, sprintf("ID=%s", getParam('ID')));

    foreach ($rows as $row) {
        ?>
        <form id="<?php echo $maintenance->formName; ?>" name="<?php echo $maintenance->formName; ?>" method="POST" action="<?php echo $maintenance->updateUrlPage; ?>">
            <table  width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th scope="col"><legend>DATOS POLITICA</legend></th>
            <th scope="col"><legend>
                <div class='btn-group' style="margin-left: 30%; margin-top: 1.4%">
                        <input type="button" name="cmdOk" id="cmdOk" class="btn btn-info" value="Guardar" onClick="javascript:formOkBt($(this.form),updateAction);jQuery('#cmAddcontainer,#cmBack').show();" />
                        <input type="button" class="btn btn-info" value='Eliminar' name="eliminar" id="btneliminar"onclick="javascript:deleteAction('<?php echo $maintenance->deleteUrlPage; ?>',<?php echo $maintenance->getDeleteUrl(); ?>);jQuery('#cmAddcontainer,#cmBack').show();" value="" />        
                        <input type="button" name="cmdCancel" id="cmdCancel" class="btn btn-info" value="Cancelar" onClick="loadTable();jQuery('#cmAddcontainer,#cmBack').show();" />
                </div></legend>
            </th>
                </tr>
                <tr>
                    <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">

                            <tr>
                                <td width="25%">NOMBRE </td>
                                <td width="75%"><input name="NAME" type="text" id="NAME" value="<?php echo $row['NAME']; ?>" />          </td>
                            </tr>
                            <tr>
                                <td>FRECUENCIA</td>
                                <td>
                                    <select name="FRECUENCY" id="FRECUENCY">
                                        <option value="1" <?php if (!strcmp(1, $row['FRECUENCY'])) {
            print 'selected="selected"';
        } ?> >MENSUAL</option>
                                        <option value="2" <?php if (!strcmp(2, $row['FRECUENCY'])) {
            print 'selected="selected"';
        } ?> >BIMESTRAL</option>
                                        <option value="3" <?php if (!strcmp(3, $row['FRECUENCY'])) {
            print 'selected="selected"';
        } ?> >TRIMESTRAL</option>
                                        <option value="4" <?php if (!strcmp(4, $row['FRECUENCY'])) {
            print 'selected="selected"';
        } ?> >CUATRIMESTRAL</option>
                                        <option value="5" <?php if (!strcmp(5, $row['FRECUENCY'])) {
            print 'selected="selected"';
        } ?> >QUINQUEMESTRAL</option>
                                        <option value="6" <?php if (!strcmp(6, $row['FRECUENCY'])) {
            print 'selected="selected"';
        } ?> >SEMESTRAL</option>
                                        <option value="12" <?php if (!strcmp(12, $row['FRECUENCY'])) {
            print 'selected="selected"';
        } ?> >ANUAL</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>NUMERO DE CARGOS</td>
                                <td><input name="COUNT" type="text" id="COUNT" value="<?php echo $row['COUNT']; ?>" /></td>
                            </tr>
                            <tr>
                                <td>DIA A APLICAR</td>
                                <td><input name="DAY_APPLY" type="text" id="DAY_APPLY" value="<?php echo $row['DAY_APPLY']; ?>" /></td>
                            </tr>
                            <tr>
                                <td>MES APLICACION</td>
                                <td>
                                    <select name="MONTH_APPLY" id="MONTH_APPLY">
                                        <option value="1"  <?php print $row['MONTH_APPLY'] == 1 ? 'selected="selected"' : ''; ?>>Mes 1</option>
                                        <option value="2"  <?php print $row['MONTH_APPLY'] == 2 ? 'selected="selected"' : ''; ?>>Mes 2</option>
                                        <option value="3"  <?php print $row['MONTH_APPLY'] == 3 ? 'selected="selected"' : ''; ?>>Mes 3</option>
                                        <option value="4"  <?php print $row['MONTH_APPLY'] == 4 ? 'selected="selected"' : ''; ?>>Mes 4</option>
                                        <option value="5"  <?php print $row['MONTH_APPLY'] == 5 ? 'selected="selected"' : ''; ?>>Mes 5</option>
                                        <option value="6"  <?php print $row['MONTH_APPLY'] == 6 ? 'selected="selected"' : ''; ?>>Mes 6</option>
                                        <option value="7"  <?php print $row['MONTH_APPLY'] == 7 ? 'selected="selected"' : ''; ?>>Mes 7</option>
                                        <option value="8"  <?php print $row['MONTH_APPLY'] == 8 ? 'selected="selected"' : ''; ?>>Mes 8</option>
                                        <option value="9"  <?php print $row['MONTH_APPLY'] == 9 ? 'selected="selected"' : ''; ?>>Mes 9</option>
                                        <option value="10" <?php print $row['MONTH_APPLY'] == 10 ? 'selected="selected"' : ''; ?>>Mes 10</option>
                                        <option value="11" <?php print $row['MONTH_APPLY'] == 11 ? 'selected="selected"' : ''; ?>>Mes 11</option>
                                        <option value="12" <?php print $row['MONTH_APPLY'] == 12 ? 'selected="selected"' : ''; ?>>Mes 12</option>
                                        <option value="13" <?php print $row['MONTH_APPLY'] == 13 ? 'selected="selected"' : ''; ?>>Mes 13</option>
                                        <option value="14" <?php print $row['MONTH_APPLY'] == 14 ? 'selected="selected"' : ''; ?>>Mes 14</option>
                                        <option value="15" <?php print $row['MONTH_APPLY'] == 15 ? 'selected="selected"' : ''; ?>>Mes 15</option>
                                        <option value="16" <?php print $row['MONTH_APPLY'] == 16 ? 'selected="selected"' : ''; ?>>Mes 16</option>
                                        <option value="17" <?php print $row['MONTH_APPLY'] == 17 ? 'selected="selected"' : ''; ?>>Mes 17</option>
                                        <option value="18" <?php print $row['MONTH_APPLY'] == 18 ? 'selected="selected"' : ''; ?>>Mes 18</option>
                                        <option value="19" <?php print $row['MONTH_APPLY'] == 19 ? 'selected="selected"' : ''; ?>>Mes 19</option>
                                        <option value="20" <?php print $row['MONTH_APPLY'] == 20 ? 'selected="selected"' : ''; ?>>Mes 20</option>
                                        <option value="21" <?php print $row['MONTH_APPLY'] == 21 ? 'selected="selected"' : ''; ?>>Mes 21</option>
                                        <option value="22" <?php print $row['MONTH_APPLY'] == 22 ? 'selected="selected"' : ''; ?>>Mes 22</option>
                                        <option value="23" <?php print $row['MONTH_APPLY'] == 23 ? 'selected="selected"' : ''; ?>>Mes 23</option>
                                        <option value="24" <?php print $row['MONTH_APPLY'] == 24 ? 'selected="selected"' : ''; ?>>Mes 24</option>
                                        <option value="25" <?php print $row['MONTH_APPLY'] == 25 ? 'selected="selected"' : ''; ?>>Mes 25</option>
                                        <option value="26" <?php print $row['MONTH_APPLY'] == 26 ? 'selected="selected"' : ''; ?>>Mes 26</option>
                                        <option value="27" <?php print $row['MONTH_APPLY'] == 27 ? 'selected="selected"' : ''; ?>>Mes 27</option>
                                        <option value="28" <?php print $row['MONTH_APPLY'] == 28 ? 'selected="selected"' : ''; ?>>Mes 28</option>
                                        <option value="29" <?php print $row['MONTH_APPLY'] == 29 ? 'selected="selected"' : ''; ?>>Mes 29</option>
                                        <option value="30" <?php print $row['MONTH_APPLY'] == 30 ? 'selected="selected"' : ''; ?>>Mes 30</option>
                                        <option value="31" <?php print $row['MONTH_APPLY'] == 31 ? 'selected="selected"' : ''; ?>>Mes 31</option>
                                        <option value="32" <?php print $row['MONTH_APPLY'] == 32 ? 'selected="selected"' : ''; ?>>Mes 32</option>
                                        <option value="33" <?php print $row['MONTH_APPLY'] == 33 ? 'selected="selected"' : ''; ?>>Mes 33</option>
                                        <option value="34" <?php print $row['MONTH_APPLY'] == 34 ? 'selected="selected"' : ''; ?>>Mes 34</option>
                                        <option value="35" <?php print $row['MONTH_APPLY'] == 35 ? 'selected="selected"' : ''; ?>>Mes 35</option>
                                        <option value="36" <?php print $row['MONTH_APPLY'] == 36 ? 'selected="selected"' : ''; ?>>Mes 36</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>MONTO</td>
                                <td><input name="AMOUNT" type="text" id="AMOUNT" value="<?php echo number_format($row['AMOUNT'], 2, ".", ","); ?>" /></td>
                            </tr>
                            <tr>
                                <td>MORA</td>
                                <td><input name="PENAL" type="text" id="PENAL" value="<?php echo number_format($row['PENALTY'], 2, ".", ","); ?>"/>
                                    <input type="hidden" name="ID" id="ID" value="<?php echo getParam('ID'); ?>" /></td>
                            </tr>
                            <tr>
                                <td>MONEDA</td>
                                <td><select name="MONEDA" id="MONEDA">
                                        <option value="1" <?php
                                if (!(strcmp(1, $row['MONEDA']))) {
                                    echo "selected=\"selected\"";
                                }
                                ?>>QUETZAL</option>
                                        <option value="2" <?php
                                if (!(strcmp(2, $row['MONEDA']))) {
                                    echo "selected=\"selected\"";
                                }
        ?>>DOLAR</option>
                                    </select>
                                </td>
                            </tr>



                        </table></td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
            </table>
        </form>  
        <?php
    }
}
?>
